<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <title>搜索</title>

    <link href="__PUBLIC__/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css" />

    <link href="__PUBLIC__/basic/css/demo.css" rel="stylesheet" type="text/css" />

    <link href="__PUBLIC__/css/seastyle.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="__PUBLIC__/basic/js/jquery-1.7.min.js"></script>
    <!--<script type="text/javascript" src="__PUBLIC__/js/script.js"></script>-->
    <style>
        a:hover, a:focus{
            color: #FFAD01;
        }
    </style>
</head>

<body onload="getGoodsList()">

<!--顶部导航条 -->


<!--悬浮搜索框-->

<div class="am-g am-text-center" style="background-color: #FFAD01">
    <div class="am-u-sm-2 " style="margin-top: 1%">
        <img src="__PUBLIC__/new_images/logo.png" width="50" height="50" alt="">
    </div>
    <div class="am-u-sm-8 am-padding-0">
        <a name="index_none_header_sysc" href="#"></a>
        <input type="hidden" name="type" id="search_type" value="{$type}">
        <input type="hidden" name="category_id" id="category_id" value="{$category_id}">
        <input id="searchInput" name="index_none_header_sysc" class="search" value="{$search}" type="text" placeholder="搜索" autocomplete="off">

        <input type="hidden" id="pagenum_hidden" value="1">
    </div>
    <div class="am-u-sm-2 am-padding-0 ">
        <input type="hidden" id="sort_type" value="0">
        <a href="#" style="display: block;line-height: 60px;font-size: 18px;color: #FFF" onclick="getGoodsList()">
            搜索
        </a>
    </div>
</div>

<div class="clear"></div>
<b class="line"></b>
<div class="">
    <div class="search-list">
        <div class="nav-table">
            <div class="long-title"><span class="all-goods">全部分类</span></div>
            <div class="nav-cont">
                <ul>
                    <li class="index"><a href="#">首页</a></li>
                    <li class="qc"><a href="#">闪购</a></li>
                    <li class="qc"><a href="#">限时抢</a></li>
                    <li class="qc"><a href="#">团购</a></li>
                    <li class="qc last"><a href="#">大包装</a></li>
                </ul>
                <div class="nav-extra">
                    <i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的福利
                    <i class="am-icon-angle-right" style="padding-left: 10px;"></i>
                </div>
            </div>
        </div>


        <div class="am-g am-g-fixed">
            <div class="am-u-sm-12 am-u-md-12" style="margin-bottom: 35px;">
                <div class="theme-popover">
                    <!--<div class="searchAbout">-->
                        <!--<span class="font-pale">相关搜索：</span>-->
                        <!--<a title="坚果" href="#">坚果</a>-->
                        <!--<a title="瓜子" href="#">瓜子</a>-->
                        <!--<a title="鸡腿" href="#">豆干</a>-->

                    <!--</div>-->
                    <!--<ul class="select">-->
                        <!--<p class="title font-normal">-->
                            <!--<span class="fl" id="search_text">{$search}</span>-->
                            <!--<span class="total fl">搜索到<strong class="num" id="search_num">997</strong>件相关商品</span>-->
                        <!--</p>-->
                        <!--<div class="clear"></div>-->
                        <!--<li class="select-result">-->
                            <!--<dl>-->
                                <!--<dt>已选</dt>-->
                                <!--<dd class="select-no"></dd>-->
                                <!--<p class="eliminateCriteria">清除</p>-->
                            <!--</dl>-->
                        <!--</li>-->
                        <!--<div class="clear"></div>-->
                        <!--<li class="select-list">-->
                            <!--<dl id="select1">-->
                                <!--<dt class="am-badge am-round">品牌</dt>-->

                                <!--<div class="dd-conent">-->
                                    <!--<dd class="select-all selected"><a href="#">全部</a></dd>-->
                                    <!--<dd><a href="#">百草味</a></dd>-->
                                    <!--<dd><a href="#">良品铺子</a></dd>-->
                                    <!--<dd><a href="#">新农哥</a></dd>-->
                                    <!--<dd><a href="#">楼兰蜜语</a></dd>-->
                                    <!--<dd><a href="#">口水娃</a></dd>-->
                                    <!--<dd><a href="#">考拉兄弟</a></dd>-->
                                <!--</div>-->

                            <!--</dl>-->
                        <!--</li>-->
                        <!--<li class="select-list">-->
                            <!--<dl id="select2">-->
                                <!--<dt class="am-badge am-round">种类</dt>-->
                                <!--<div class="dd-conent">-->
                                    <!--<dd class="select-all selected"><a href="#">全部</a></dd>-->
                                    <!--<dd><a href="#">东北松子</a></dd>-->
                                    <!--<dd><a href="#">巴西松子</a></dd>-->
                                    <!--<dd><a href="#">夏威夷果</a></dd>-->
                                    <!--<dd><a href="#">松子</a></dd>-->
                                <!--</div>-->
                            <!--</dl>-->
                        <!--</li>-->
                        <!--<li class="select-list">-->
                            <!--<dl id="select3">-->
                                <!--<dt class="am-badge am-round">选购热点</dt>-->
                                <!--<div class="dd-conent">-->
                                    <!--<dd class="select-all selected"><a href="#">全部</a></dd>-->
                                    <!--<dd><a href="#">手剥松子</a></dd>-->
                                    <!--<dd><a href="#">薄壳松子</a></dd>-->
                                    <!--<dd><a href="#">进口零食</a></dd>-->
                                    <!--<dd><a href="#">有机零食</a></dd>-->
                                <!--</div>-->
                            <!--</dl>-->
                        <!--</li>-->

                    <!--</ul>-->
                    <div class="clear"></div>
                </div>
                <div class="search-content">
                    <div class="sort">
                        <li class="first" onclick="sortGoods(0)"><a title="综合">综合排序</a></li>
                        <li onclick="sortGoods(1)"><a title="销量">销量排序</a></li>
                        <li onclick="sortGoods(2)"><a title="价格">价格优先</a></li>
                        <li class="big"><a title="评价" href="#">评价为主</a></li>
                    </div>
                    <div class="clear"></div>

                    <ul class="am-avg-sm-2 am-avg-md-3 am-avg-lg-4 boxes" id="goodsList">
                        <li>
                            <div class="i-pic limit">
                                <img src="__PUBLIC__/images/imgsearch1.jpg" />
                                <p class="title fl">【良品铺子旗舰店】手剥松子218g 坚果炒货零食新货巴西松子包邮</p>
                                <p class="price fl">
                                    <b>¥</b>
                                    <strong>56.90</strong>
                                </p>
                                <p class="number fl">
                                    销量<span>1110</span>
                                </p>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="search-side">

                    <div class="side-title">
                        经典搭配
                    </div>

                    <li>
                        <div class="i-pic check">
                            <img src="__PUBLIC__/images/cp.jpg" />
                            <p class="check-title">萨拉米 1+1小鸡腿</p>
                            <p class="price fl">
                                <b>¥</b>
                                <strong>29.90</strong>
                            </p>
                            <p class="number fl">
                                销量<span>1110</span>
                            </p>
                        </div>
                    </li>
                    <li>
                        <div class="i-pic check">
                            <img src="__PUBLIC__/images/cp2.jpg" />
                            <p class="check-title">ZEK 原味海苔</p>
                            <p class="price fl">
                                <b>¥</b>
                                <strong>8.90</strong>
                            </p>
                            <p class="number fl">
                                销量<span>1110</span>
                            </p>
                        </div>
                    </li>
                    <li>
                        <div class="i-pic check">
                            <img src="__PUBLIC__/images/cp.jpg" />
                            <p class="check-title">萨拉米 1+1小鸡腿</p>
                            <p class="price fl">
                                <b>¥</b>
                                <strong>29.90</strong>
                            </p>
                            <p class="number fl">
                                销量<span>1110</span>
                            </p>
                        </div>
                    </li>

                </div>
                <div class="clear"></div>
                <!--分页 -->
                <ul class="am-pagination am-pagination-right" id="page_list">
                </ul>

            </div>
        </div>

    </div>

</div>

<!--引导 -->
<include file="Public:bottom_navbar" />


<script>
    window.jQuery || document.write('<script src="__PUBLIC__/basic/js/jquery-1.9.min.js"><\/script>');

</script>
<script type="text/javascript" src="__PUBLIC__/basic/js/quick_links.js"></script>

<script type="application/javascript">

    function getGoodsListByPage(pagenum) {
        //提交form
        $('#pagenum_hidden').val(pagenum);
        getGoodsList();
    }
    $('#searchInput').bind('keyup', function(event) {
        if (event.keyCode == "13") {
            var search = $('#searchInput').val();
            if(!search || search==''){
                return;
            }
            $('#pagenum_hidden').val(1);
            getGoodsList();
        }

    });
    function getGoodsList() {

        $.ajax({
            type: "POST",
            url: "__URL__/goodsList",
            data: {
                'pagenum': $('#pagenum_hidden').val(),
                'search': $('#searchInput').val(),
                'type':$('#search_type').val(),
                'category_id':$('#category_id').val(),
                'sort_type':$('#sort_type').val()
            },
            dataType: "json",
            success: function (data) {
                console.info(data);

                $('#search_num').html(data.page.totalrecord);
                $('#search_type').val(0);
                var html = '';
               // alert(data.page.totalpage);
                if (data.page.totalpage == 0) {
                    html += '<div class="am-u-sm-6 border_info_left">暂无数据</div>';
                    $('#goodsList').empty().append(html);
                    return;
                }
                $.each(data.list, function (n, item) {
                    html += '<li onclick="detail('+ item.goods_id +')"><div class="i-pic limit">';
                    html += '<img src="'+item.original_img+'" width="100%" />';
                    html +='<p class="title fl">'+item.goods_name+'</p>';
                    html +='<p class="price fl" style="float: left;">';
                    html +='<b>¥</b>';
                    html +='<strong>'+item.shop_price+'</strong>';
                    html +='</p> <p class="number fl">';
                    html +='销量<span>'+item.sales_sum+'</span>';
                    html +='</p> </div> </li>';

                });
                //分页数据
                //html = appendPageHtml(html, data, 'getKaituanList');
                $('#goodsList').empty().append(html);
                $('#search_text').empty().append($('#searchInput').val());
                $('#pagenum_hidden').val(data.page.pagenum);
                makePageHtml(data);
            }
        });

        function makePageHtml(data) {
            var html = '';
            if (data.page.pagenum == '1') {
                html += '<li class="am-disabled">';
            } else {
                html += '<li>';
            }
            html +='<a  onclick="getGoodsListByPage(' + data.page.startPage + ')">&laquo;</a></li>';
            for (var i = data.page.startPage; i <= data.page.endPage; i++) {
                if (data.page.pagenum == i) {
                    html += '<li class="am-active"><a style="background-color: #FFAD01;border-color: #FFAD01;">' + i + '</a></li>';
                } else {
                    html += '<li><a onclick="getGoodsListByPage(' + i + ')">' + i + '</a></li>';
                }
            }
            if (data.page.pagenum == data.page.totalpage) {
                html += '<li class="am-disabled">';
                html += '<a href="#">&raquo;</a></li>';
            }else{
                html +='<li>';
                html += '<a onClick="getGoodsListByPage(' + data.page.totalpage + ')">&raquo;</a></li>';
            }
            $('#pagenum_hidden').val(data.page.pagenum);
            $('#page_list').empty().append(html);
        }
    }


    function detail(id){

        window.location.href = '__URL__/introduction?goods_id=' + id;
    }

    function sortGoods(type){
        $('#sort_type').val(type);
        getGoodsList();

    }
</script>

<div class="theme-popover-mask"></div>

</body>

</html>